package pe.edu.upc.dew.util;

public class Util {

	public static String completarConSimbolo(String pValor, int pLongitud, String pSimbolo, String pAlineacion) {
		String tempString = pValor;
		for (int i = pValor.length(); i < pLongitud; i++) {
			if (pAlineacion.trim().equalsIgnoreCase("I"))
				tempString = pSimbolo + tempString;
			else
				tempString += pSimbolo;
		}
		return tempString;
	}

	public static String caracterIzquierda(int parmint, int parmLon, String parmCaracter) {
		return caracterIzquierda(String.valueOf(parmint), parmLon, parmCaracter);
	}

	public static String caracterIzquierda(long parmlong, int parmLon, String parmCaracter) {
		return caracterIzquierda(String.valueOf(parmlong), parmLon, parmCaracter);
	}

	public static String caracterIzquierda(double parmdou, int parmLon, String parmCaracter) {
		return caracterIzquierda(String.valueOf(parmdou), parmLon, parmCaracter);
	}

	public static String caracterIzquierda(String parmString, int parmLon, String parmCaracter) {

		String tempString = parmString;

		if (tempString.length() > parmLon)
			tempString = tempString.substring(tempString.length() - parmLon, tempString.length());
		else {
			while (tempString.length() < parmLon)
				tempString = parmCaracter + tempString;
		}

		return tempString;

	}
}
